package com.CISS.controller;


import com.CISS.entity.Cisuser;
import com.CISS.service.CisuserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@RestController
@RequestMapping(value = "/Cisuser")
public class CisuserController {

    @Autowired
    private CisuserService service;

    @RequestMapping(value = "/login")
    public boolean login(@RequestParam(value = "username",required = true) String username,
                         @RequestParam(value = "password",required = true) String password,
                         @RequestParam(value = "type",required = true) String type){
        //service = new CisuserService();
        return service.login(username, password, type);
    }

    @RequestMapping(value = "/registM")
    public boolean registM(@RequestParam(value = "CompanyName",required = true)String CompanyName,
                           @RequestParam(value = "CompanyAddress",required = true)String CompanyAddress,
                           @RequestParam(value = "Username",required = true)String Username,
                           @RequestParam(value = "password",required = true)String password,
                           @RequestParam(value = "name",required = true)String name,
                           @RequestParam(value = "phone",required = true)String phone,
                           @RequestParam(value = "email",required = true)String email){
        return service.registM(CompanyName, CompanyAddress, Username, password,name, phone, email);
    }

    @RequestMapping(value = "/registE")
    public boolean registE(@RequestParam(value = "Username",required = true)String Username,
                           @RequestParam(value = "password",required = true)String password,
                           @RequestParam(value = "name",required = true)String name,
                           @RequestParam(value = "phone",required = true)String phone,
                           @RequestParam(value = "email",required = true)String email,
                           @RequestParam(value = "CompanyName",required = true)String CompanyName){
        return service.registE(Username,password,name, phone,email,CompanyName);
    }
}
